package com.framework.modules.dataview.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.common.utils.PageUtils;
import com.framework.common.utils.Query;

import com.framework.modules.dataview.dao.ViewLiveRoomListDao;
import com.framework.modules.dataview.entity.ViewLiveRoomListEntity;
import com.framework.modules.dataview.service.ViewLiveRoomListService;


@Service("viewLiveRoomListService")
public class ViewLiveRoomListServiceImpl extends ServiceImpl<ViewLiveRoomListDao, ViewLiveRoomListEntity> implements ViewLiveRoomListService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        EntityWrapper wrapper=new EntityWrapper<ViewLiveRoomListEntity>();
        if(params.containsKey("state")){
            wrapper.eq("state",params.get("state"));
        }
        if(params.containsKey("nickname")){
            wrapper.like("nickname","%"+params.get("nickname").toString()+"%");
        }
        if(params.containsKey("startTime")){
            wrapper.gt("start_date",params.get("startTime"));
        }
        Page<ViewLiveRoomListEntity> page = this.selectPage(
                new Query<ViewLiveRoomListEntity>(params).getPage(),
                wrapper
        );

        return new PageUtils(page);
    }

}
